/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ejbs;

import entities.Funcionario;
import javax.ejb.EJBException;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Yeezus
 */
@Stateless
public class FuncionarioBean {

    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
    @PersistenceContext(name = "Gestao_FarmciasPU")
    private EntityManager em;

    public boolean existeFuncionario(String username) {
        try {
            return em.find(Funcionario.class, username) != null;
        } catch (Exception e) {
            throw new EJBException(e.getMessage());
        }
    }
}
